<?php

Route::group(['middleware' => 'web', 'prefix' => 'admin', 'namespace' => 'Modules\Admin\Http\Controllers'], function()
{
    Auth::routes();

});

//配置路由组，判定用户是否登录
Route::group(['middleware' => ['web','auth:admin'], 'prefix' => 'admin', 'namespace' => 'Modules\Admin\Http\Controllers'], function()
{
    Route::get('/', 'AdminController@index');
//    后台模块资源路由
    Route::resource('adminuser', 'AdminUserController')->middleware('permission:admin,resource');
//    角色管理资源路由
    Route::resource('role', 'RoleController')->middleware('permission:admin,resource');


//    分配权限路由
    Route::get('/showPermission/{roleid}','RoleController@showPermission')->name('showPermission')->middleware('permission:admin');
//    处理权限路由
    Route::post('/permission/{roleid}','RoleController@permission')->name('permission');


//    0712
//    配置分配用户角色展示模板的路由
    Route::get('/showRole/{adminid}','AdminUserController@showRole')->name('showRole')->middleware('permission:admin');

    //创建post提交角色分配处理方法
    Route::post('/assignRole/{adminid}','AdminUserController@assignRole')->name('assignRole');

});

//0711配置角色管路路由



 
//modules-route
Route::group(['middleware' => ['web', 'auth:admin'],'prefix'=>'admin','namespace'=>"Modules\Admin\Http\Controllers"], 
function () {
//    普通跳转路由
    Route::get('/modules','ModulesController@index')->name('modules');

        //跟新缓存路由
    Route::get('/updataCache','ModulesController@updataCache')->name('updataCache');

        //配置设为默认的路由
    Route::get('/setDefaultModule/{modules}','ModulesController@setDefaultModule')->name('setDefaultModule');

//    0719
//    模块管理
    Route::get('/templates','TemplatesController@index')->name('templates');

    Route::get('/setDefaultTemplate/{name}','TemplatesController@setDefaultTemplate')->name('setDefaultTemplate');
});